```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java中的String类与基本数据类型</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=NotoSans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.8;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .code-block {
            background-color: #f8f9fa;
            border-left: 4px solid #667eea;
            padding: 1.5rem;
            border-radius: 0 4px 4px 0;
        }
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
        }
        .icon-box {
            width: 60px;
            height: 60px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 12px;
        }
        .mermaid-tooltip {
            background: white !important;
            border: 1px solid #e2e8f0 !important;
            border-radius: 4px !important;
            padding: 8px 12px !important;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        }
        .highlight {
            position: relative;
        }
        .highlight::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 10px;
            background: rgba(118, 75, 162, 0.2);
            z-index: -1;
            transform: scaleX(0);
            transform-origin: left;
            transition: transform 0.3s ease;
        }
        .highlight:hover::after {
            transform: scaleX(1);
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <header class="hero-gradient text-white py-20 px-4 md:py-32">
        <div class="max-w-4xl mx-auto text-center">
            <span class="inline-block px-4 py-2 mb-4 text-sm font-medium bg-white bg-opacity-20 rounded-full backdrop-filter backdrop-blur-sm">
                <i class="fas fa-code mr-2"></i>Java编程基础
            </span>
            <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight">
                <span class="highlight">String类</span>与基本数据类型的核心区别
            </h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-2xl mx-auto">
                深入理解Java中String的特殊性和基本数据类型的本质特征
            </p>
            <div class="mt-10">
                <a href="#content" class="inline-block px-8 py-3 bg-white text-indigo-700 font-medium rounded-lg hover:bg-opacity-90 transition duration-300 transform hover:scale-105">
                    <i class="fas fa-book-open mr-2"></i>开始学习
                </a>
            </div>
        </div>
    </header>

    <!-- Main Content -->
    <main id="content" class="max-w-5xl mx-auto px-4 py-16">
        <!-- Introduction Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-purple-600 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">核心概念</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-lg overflow-hidden">
                <div class="p-8 md:p-10">
                    <p class="text-lg text-gray-700 mb-6">
                        <span class="font-bold text-purple-700">String</span> 是 Java 的一个类，而不是基本数据类型。它提供了丰富的操作功能，并在 Java 中扮演着重要的角色。基本数据类型和 <span class="font-bold text-purple-700">String</span> 类之间的主要区别在于存储方式和功能丰富性。
                    </p>
                    
                    <div class="grid md:grid-cols-2 gap-8 mt-10">
                        <div>
                            <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                                <div class="icon-box bg-indigo-100 text-indigo-600 mr-4">
                                    <i class="fas fa-cube text-2xl"></i>
                                </div>
                                Java基本数据类型
                            </h3>
                            <p class="text-gray-600 mb-4">
                                在 Java 中，基本数据类型（primitive data types）包括：
                            </p>
                            <ul class="space-y-2 mb-6">
                                <li class="flex items-center"><i class="fas fa-caret-right text-indigo-500 mr-2"></i> <code class="bg-gray-100 px-2 py-1 rounded">byte</code></li>
                                <li class="flex items-center"><i class="fas fa-caret-right text-indigo-500 mr-2"></i> <code class="bg-gray-100 px-2 py-1 rounded">short</code></li>
                                <li class="flex items-center"><i class="fas fa-caret-right text-indigo-500 mr-2"></i> <code class="bg-gray-100 px-2 py-1 rounded">int</code></li>
                                <li class="flex items-center"><i class="fas fa-caret-right text-indigo-500 mr-2"></i> <code class="bg-gray-100 px-2 py-1 rounded">long</code></li>
                                <li class="flex items-center"><i class="fas fa-caret-right text-indigo-500 mr-2"></i> <code class="bg-gray-100 px-2 py-1 rounded">float</code></li>
                                <li class="flex items-center"><i class="fas fa-caret-right text-indigo-500 mr-2"></i> <code class="bg-gray-100 px-2 py-1 rounded">double</code></li>
                                <li class="flex items-center"><i class="fas fa-caret-right text-indigo-500 mr-2"></i> <code class="bg-gray-100 px-2 py-1 rounded">char</code></li>
                                <li class="flex items-center"><i class="fas fa-caret-right text-indigo-500 mr-2"></i> <code class="bg-gray-100 px-2 py-1 rounded">boolean</code></li>
                            </ul>
                            <p class="text-gray-600">
                                这些基本数据类型是 Java 语言的内建数据类型，用于表示简单的值（如整数、浮点数、字符和布尔值），它们在内存中以最直接的方式存储数据。
                            </p>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                                <div class="icon-box bg-purple-100 text-purple-600 mr-4">
                                    <i class="fas fa-project-diagram text-2xl"></i>
                                </div>
                                String类特点
                            </h3>
                            <ul class="space-y-4">
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 bg-purple-100 text-purple-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-layer-group"></i>
                                    </span>
                                    <div>
                                        <h4 class="font-medium text-gray-800">类型</h4>
                                        <p class="text-gray-600 text-sm"><span class="font-medium">String</span> 是一个类，属于 Java 的标准库中的 <span class="font-medium">java.lang</span> 包。</p>
                                    </div>
                                </li>
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 bg-purple-100 text-purple-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-link"></i>
                                    </span>
                                    <div>
                                        <h4 class="font-medium text-gray-800">引用类型</h4>
                                        <p class="text-gray-600 text-sm"><span class="font-medium">String</span> 是一种引用类型，意味着它是一个对象的引用，而不是存储实际的数据值。</p>
                                    </div>
                                </li>
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 bg-purple-100 text-purple-600 rounded-full p-2 mr-3">
                                        <i class="fas fa-lock"></i>
                                    </span>
                                    <div>
                                        <h4 class="font-medium text-gray-800">不可变性</h4>
                                        <p class="text-gray-600 text-sm"><span class="font-medium">String</span> 对象是不可变的（immutable），一旦创建后，其内容不能被修改。每次对 <span class="font-medium">String</span> 进行操作时，都会创建一个新的 <span class="font-medium">String</span> 对象。</p>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Comparison Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-indigo-600 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">核心区别</h2>
            </div>
            
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white rounded-xl shadow-md overflow-hidden feature-card transition duration-300">
                    <div class="p-6">
                        <div class="w-14 h-14 bg-blue-100 rounded-lg flex items-center justify-center mb-4">
                            <i class="fas fa-database text-blue-600 text-2xl"></i>
                        </div>
                        <h3 class="text-xl font-semibold mb-3 text-gray-800">存储方式</h3>
                        <p class="text-gray-600">
                            基本数据类型直接存储数据值，而 <span class="font-medium text-blue-600">String</span> 对象通过引用存储在内存中。
                        </p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden feature-card transition duration-300">
                    <div class="p-6">
                        <div class="w-14 h-14 bg-green-100 rounded-lg flex items-center justify-center mb-4">
                            <i class="fas fa-cogs text-green-600 text-2xl"></i>
                        </div>
                        <h3 class="text-xl font-semibold mb-3 text-gray-800">操作能力</h3>
                        <p class="text-gray-600">
                            <span class="font-medium text-green-600">String</span> 提供了丰富的方法用于处理字符串，而基本数据类型只能通过基本的操作符进行操作。
                        </p>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden feature-card transition duration-300">
                    <div class="p-6">
                        <div class="w-14 h-14 bg-purple-100 rounded-lg flex items-center justify-center mb-4">
                            <i class="fas fa-memory text-purple-600 text-2xl"></i>
                        </div>
                        <h3 class="text-xl font-semibold mb-3 text-gray-800">内存管理</h3>
                        <p class="text-gray-600">
                            <span class="font-medium text-purple-600">String</span> 对象在内存中有专门的管理机制，如字符串常量池，用于优化内存使用。
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Visualization Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-teal-600 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">关系图解</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-lg overflow-hidden p-6">
                <div class="mermaid">
                    graph LR
                        A[Java数据类型] --> B[基本数据类型]
                        A --> C[引用类型]
                        B --> D[数值类型]
                        B --> E[布尔类型]
                        B --> F[字符类型]
                        D --> G[byte]
                        D --> H[short]
                        D --> I[int]
                        D --> J[long]
                        D --> K[float]
                        D --> L[double]
                        E --> M[boolean]
                        F --> N[char]
                        C --> O[String类]
                        C --> P[其他类]
                        O --> Q[不可变性]
                        O --> R[字符串池]
                        O --> S[丰富方法]
                </div>
            </div>
        </section>

        <!-- Code Examples Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-orange-600 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">代码示例</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8">
                <div>
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 bg-orange-100 rounded-lg flex items-center justify-center mr-3">
                            <i class="fas fa-laptop-code text-orange-600"></i>
                        </div>
                        <h3 class="text-xl font-semibold text-gray-800">基本数据类型示例</h3>
                    </div>
                    <div class="code-block">
                        <pre><code class="text-sm">public class PrimitiveDemo {
    public static void main(String[] args) {
        int num = 10; // 基本数据类型 int
        boolean flag = true; // 基本数据类型 boolean
        
        System.out.println("num: " + num);
        System.out.println("flag: " + flag);
    }
}</code></pre>
                    </div>
                    <div class="mt-4 bg-blue-50 border-l-4 border-blue-500 p-4 rounded-r">
                        <p class="text-blue-800 flex items-start">
                            <i class="fas fa-info-circle mt-1 mr-2 flex-shrink-0"></i>
                            <span>基本数据类型直接存储值，int 存储整数，boolean 存储 true/false 值。</span>
                        </p>
                    </div>
                </div>
                
                <div>
                    <div class="flex items-center mb-4">
                        <div class="w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center mr-3">
                            <i class="fas fa-code text-purple-600"></i>
                        </div>
                        <h3 class="text-xl font-semibold text-gray-800">String类示例</h3>
                    </div>
                    <div class="code-block">
                        <pre><code class="text-sm">public class StringDemo{
    public static void main(String[] args) {
        String str = "Hello, World!"; // 创建一个 String 对象
        int length = str.length(); // 调用 String 类的方法
        
        System.out.println("String: " + str);
        System.out.println("Length: " + length);
    }
}</code></pre>
                    </div>
                    <div class="mt-4 bg-purple-50 border-l-4 border-purple-500 p-4 rounded-r">
                        <p class="text-purple-800 flex items-start">
                            <i class="fas fa-info-circle mt-1 mr-2 flex-shrink-0"></i>
                            <span>String 是对象，可以调用方法如 length()，且内容不可变，操作会返回新对象。</span>
                        </p>
                    </div>
                </div>
            </div>
        </section>

        <!-- Key Takeaways Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-red-600 rounded-full"></div>
                <h2 class="ml-4 text-3xl font-bold text-gray-800">关键要点</h2>
            </div>
            
            <div class="bg-white rounded-xl shadow-lg overflow-hidden">
                <div class="p-8 md:p-10">
                    <div class="grid md:grid-cols-2 gap-8">
                        <div>
                            <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                                <div class="icon-box bg-red-100 text-red-600 mr-4">
                                    <i class="fas fa-exclamation-circle text-2xl"></i>
                                </div>
                                核心区别总结
                            </h3>
                            <ul class="space-y-4">
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 mt-1">
                                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                                    </span>
                                    <span class="text-gray-700">String 是对象，基本数据类型不是</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 mt-1">
                                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                                    </span>
                                    <span class="text-gray-700">String 存储在堆内存，基本数据类型存储在栈</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 mt-1">
                                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                                    </span>
                                    <span class="text-gray-700">String 有方法，基本数据类型只有运算符</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 mt-1">
                                        <i class="fas fa-check-circle text-green-500 mr-3"></i>
                                    </span>
                                    <span class="text-gray-700">String 默认值为 null，基本数据类型有各自的默认值</span>
                                </li>
                            </ul>
                        </div>
                        
                        <div>
                            <h3 class="text-xl font-semibold mb-4 text-gray-800 flex items-center">
                                <div class="icon-box bg-yellow-100 text-yellow-600 mr-4">
                                    <i class="fas fa-lightbulb text-2xl"></i>
                                </div>
                                最佳实践
                            </h3>
                            <ul class="space-y-4">
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 mt-1">
                                        <i class="fas fa-star text-yellow-500 mr-3"></i>
                                    </span>
                                    <span class="text-gray-700">对大量字符串操作考虑使用 StringBuilder</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 mt-1">
                                        <i class="fas fa-star text-yellow-500 mr-3"></i>
                                    </span>
                                    <span class="text-gray-700">字符串比较使用 equals() 而不是 ==</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 mt-1">
                                        <i class="fas fa-star text-yellow-500 mr-3"></i>
                                    </span>
                                    <span class="text-gray-700">了解自动装箱和拆箱机制</span>
                                </li>
                                <li class="flex items-start">
                                    <span class="flex-shrink-0 mt-1">
                                        <i class="fas fa-star text-yellow-500 mr-3"></i>
                                    </span>
                                    <span class="text-gray-700">合理使用基本数据类型提高性能</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="max-w-5xl mx-auto px-4">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-semibold text-white mb-2">技术小馆</h3>
                    <p class="text-gray-400">专业的编程技术知识分享</p>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="text-gray-300 hover:text-white transition duration-300 flex items-center">
                        <i class="fas fa-globe mr-2"></i>
                        <span>http://www.yuque.com/jtostring</span>
                    </a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-sm text-gray-500">
                &copy; 2023 技术小馆. 保留所有权利.
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            },
            themeCSS: `
                .node rect {
                    fill: #f8fafc;
                    stroke: #cbd5e1;
                    stroke-width: 2px;
                }
                .node .label {
                    color: #334155;
                    font-family: 'Noto Sans SC', sans-serif;
                }
                .edgePath .path {
                    stroke: #94a3b8;
                    stroke-width: 2px;
                }
                .cluster rect {
                    fill: #e2e8f0;
                    stroke: #94a3b8;
                    stroke-width: 1px;
                    rx: 5;
                    ry: 5;
                }
            `
        });
        
        // 微交互：滚动动画
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```